<?php 
class X_audio extends X{
    public static function renderAudioElement($file, $id=null, $autoplay=false, $loop=false, $controls=false, $preload='auto', $fallback=null){
        if(!is_array($file) && !strstr($file, '.')) $file= array($file.'.ogg',$file.'.mpg');
        ?><audio<?php 
        if($id!==null)echo ' id="'.$id.'"';
        if(!is_array($file))echo ' src="'.$file.'"';
        if($autoplay)echo ' autoplay="autoplay"';
        if($loop)echo ' loop="loop"';
        if($controls)echo ' controls="controls"';
        if(!empty($preload))echo ' preload="'.$preload.'"';
        ?>><?php if(is_array($file))foreach($file as $f){?><source src="<?php echo $f; ?>" /><?php } if($fallback) echo $fallback;?></audio><?php
    }
    
}